package org.spring.config.client.config;

import java.util.List;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class ClientWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {

    /**
     * 配置静态访问资源
     * 
     * @param registry
     */
    // @Override
    // public void addResourceHandlers(ResourceHandlerRegistry registry) {
    // registry.addResourceHandler("/my/**").addResourceLocations("classpath:/my/");
    // super.addResourceHandlers(registry);
    // }

    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        // argumentResolvers.add(new MultiRequestBodyArgumentResolver());
    }

    // @Bean
    // public FilterRegistrationBean encodingFilterRegistration() {
    // FilterRegistrationBean registration = new FilterRegistrationBean();
    // registration.setFilter(new EncodingFilter());
    // return registration;
    // }

    // @Bean
    // public Filter encodingFilter() {
    // return new EncodingFilter();
    // }
    // @Bean
    // public FilterRegistrationBean securityFilterRegistration() {
    // FilterRegistrationBean fitler = new FilterRegistrationBean();
    // fitler.addInitParameter("targetFilterLifecycle","true");
    // fitler.setEnabled(false);
    // fitler.setFilter(new DelegatingFilterProxy("securityFilter"));
    // fitler.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
    // fitler.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico");
    //
    // return fitler;
    // }

    /**
     * 以前要访问一个页面需要先创建个Controller控制类，再写方法跳转到页面 在这里配置后就不需要那么麻烦了，直接访问http://127.0.0.1:10000/page/login就跳转到login.html页面了
     * 
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {

        super.addViewControllers(registry);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        super.addInterceptors(registry);
    }

//    @Bean
//    public ScriptFactoryPostProcessor scriptFactoryPostProcessor() {
//        ScriptFactoryPostProcessor scriptFactoryPostProcessor = new ScriptFactoryPostProcessor();
//
//        return scriptFactoryPostProcessor;
//    }
//
//    @Bean
//    public GroovyFactory groovyFactory() {
//        GroovyFactory groovyFactory = new GroovyFactory();
//        return groovyFactory;
//    }
    
    
//    @Bean
//    public DynamicDeployBeans2 dynamicDeployBeans2() {
//        DynamicDeployBeans2 dynamicDeployBeans2 = new DynamicDeployBeans2();
//        dynamicDeployBeans2.setRefreshCheckDelay(500L);
//        return dynamicDeployBeans2;
//    }
    
    
    

}